/*
 * GJ_mode.c
 *
 *  Created on: 2021年2月17日
 *      Author: gary
 */

#include "GJ_mode.h"

HAL_GJ_typedef HAL_MyGJ = {0};

void GJ_Init(void)
{
	HAL_MyGJ.mode = 0;
	HAL_MyGJ.speed = 1;
	for(uint8_t i = 0; i < PIXEL_NUM; i++)
	{
		HAL_MyGJ.colorBuffer[i * 3] = 10;
		HAL_MyGJ.colorBuffer[i * 3 + 1] = 10;
		HAL_MyGJ.colorBuffer[i * 3 + 2] = 10;
	}
	WS2812_SetPixelBuffer(HAL_MyGJ.colorBuffer);
	WS2812_SendData();
}

void GJ_SetAllColor(uint8_t r, uint8_t g, uint8_t b)
{
	for(uint8_t i = 0; i < PIXEL_NUM; i++)
	{
		HAL_MyGJ.colorBuffer[i * 3] = g;
		HAL_MyGJ.colorBuffer[i * 3 + 1] = r;
		HAL_MyGJ.colorBuffer[i * 3 + 2] = b;
	}
	WS2812_SetPixelBuffer(HAL_MyGJ.colorBuffer);
	WS2812_SendData();
}

void GJ_mode0()
{
	WS2812_SetPixelBuffer(HAL_MyGJ.colorBuffer);
}

void GJ_mode1()
{

}

void GJ_mode2()
{

}

void GJ_TimerIRQ(void)
{
	switch(HAL_MyGJ.mode)
	{
		case 0:
			GJ_mode0();
			break;
		case 1:
			break;
		case 2:
			break;
		default:
			break;
	}
	WS2812_SendData();
}
